﻿using FireStarterModeller.BO;
using Habanero.UI.Base;
using Habanero.UI.Win;

namespace FireStarterModeller.UI
{
    class RelationshipCollapsiblePanel : PanelWin
    {
         private readonly IControlFactory _controlFactory;
        private readonly RelationshipInfosControl _relationshipInfosControl;
        private readonly ICollapsiblePanel _collapsiblePanel;
        private BO.DMClass _dmClass;



        public RelationshipCollapsiblePanel()
        {
            _controlFactory = GlobalUIRegistry.ControlFactory;
            _collapsiblePanel = _controlFactory.CreateCollapsiblePanel();
            _relationshipInfosControl = new RelationshipInfosControl(_controlFactory);
            _relationshipInfosControl.Height = 200;
            _collapsiblePanel.ContentControl = _relationshipInfosControl;
            _collapsiblePanel.Height = _collapsiblePanel.CollapseButton.Height + _relationshipInfosControl.Height;
            _collapsiblePanel.Collapsed = true;
            _collapsiblePanel.CollapseButton.Text = "Relationships";;
            //collapsiblePanel.CollapseButton.ForeColor = Color.White;
            //((ButtonWin)collapsiblePanel.CollapseButton).TextAlign = ContentAlignment.MiddleLeft;
            BorderLayoutManager layoutManager = _controlFactory.CreateBorderLayoutManager(this);
            layoutManager.AddControl(_collapsiblePanel, BorderLayoutManager.Position.Centre);

        }

        public ICollapsiblePanel CollapsiblePanel
        {
            get { return _collapsiblePanel; }
        }

        public DMClass DMClass
        {
            get
            {
                return _dmClass;
            }
            set
            {
                _dmClass = value;
                _relationshipInfosControl.Class = _dmClass;
            }
        }

    }
}
